package com.tanhua.manager.job;

import com.tanhua.manager.service.UserFreezeService;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Mr.Seven
 * @date 2021/03/01 23:33
 */
@Component
public class UnfreezeUserJob {
    /**
     * Mr.Seven的基操
     */

    @Autowired
    private UserFreezeService userFreezeService;

    // 设置每天凌晨0点执行一次的定时任务
    @Scheduled(cron = "0 0 0 1/1 * ?")
    public void autoUnfreezeJob() {
        System.out.println("==开始定时执行，当前时间是：" + new DateTime().toString("yyyy-MM-dd HH:mm:ss") + "==");
        userFreezeService.autoUnfreeze();
        System.out.println("==统计完成==");
    }
}
